package mock

import (
	"context"
)

/*
gomock 测试
*/
type User struct {
	Mobile   string
	Password string
	Nickname string
}
type UserServer struct {
	Db UserData
}

func (us *UserServer) GetUserByMobile(ctx context.Context, mobile string) (User, error) {
	user, err := us.Db.GetUserByMobile(ctx, mobile)
	if err != nil {
		return User{}, err
	}
	if user.Nickname == "jzin18" {
		user.Nickname = "jzin17"
	}
	return user, nil
}

type UserData interface {
	GetUserByMobile(ctx context.Context, mobile string) (User, error)
}
